﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace Games.Data
{
    public interface IDataBase
    {
        void DropTable<T>() where T : Entity, new();
        void CreateTable<T>() where T : Entity, new();
        Task<int> DeleteAsync<T>(int id) where T : Entity, new();
        Task<T> GetAsync<T>(int id) where T : Entity, new();
        Task<Paged<T>> GetPageAsync<T>(Expression<Func<T, bool>> expression, Sorter<T> sorter, int pageIndex, int pageSize) where T : Entity, new();
        Task<List<T>> GetAllAsync<T>(Expression<Func<T, bool>> expression, Sorter<T> sorter = null) where T : Entity, new();
        Task<T> GetFirstOrDefaultAsync<T>(Expression<Func<T, bool>> expression, Sorter<T> sorter = null) where T : Entity, new();
        Task<int> SaveAsync<T>(T t) where T : Entity, new();
    }
}